﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication1
{
    public class Print_PDF
    {
        public void print_event()//function print bta3t omnia
        {
            try
            {

                PrintDocument pd = new PrintDocument();
                pd.DefaultPageSettings.PaperSize = new PaperSize("A4", 800, 1170);
                pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
                pd.Print();

            }
            catch (Exception ex)
            {
                MessageBox.Show("Error", ex.ToString());
            }

        }

        public void pd_PrintPage(object sender, PrintPageEventArgs ev)
        {
            event_show ob = new event_show();

            ev.Graphics.DrawString("Print of an Event", new Font("Times New Roman", 23, FontStyle.Underline), Brushes.Red, 300, 0);

            ev.Graphics.DrawString("Your Event :", new Font("Times New Roman", 20, FontStyle.Bold), Brushes.Red, 50, 100);
            ev.Graphics.DrawString(event_show.Event, new Font("Times New Roman", 20, FontStyle.Italic), Brushes.Purple, 230, 100);

            ev.Graphics.DrawString("Date:", new Font("Times New Roman", 20, FontStyle.Bold), Brushes.Red, 50, 200);
            ev.Graphics.DrawString(event_show.Days +"/", new Font("Times New Roman", 20, FontStyle.Italic), Brushes.Purple, 150, 200);
            ev.Graphics.DrawString(event_show.Month + "/", new Font("Times New Roman", 20, FontStyle.Italic), Brushes.Purple, 300,200);
            ev.Graphics.DrawString(event_show.Year, new Font("Times New Roman", 20, FontStyle.Italic), Brushes.Purple, 350, 200);

            ev.Graphics.DrawString("Time is from", new Font("Times New Roman", 20, FontStyle.Bold), Brushes.Red, 50, 300);
            ev.Graphics.DrawString(event_show.From, new Font("Times New Roman", 20, FontStyle.Italic), Brushes.Purple, 220, 300);

            ev.Graphics.DrawString("to", new Font("Times New Roman", 20, FontStyle.Bold), Brushes.Red, 270, 300);
            ev.Graphics.DrawString(event_show.To, new Font("Times New Roman", 20, FontStyle.Italic), Brushes.Purple, 320, 300);
        }
    }
}
